#include <iostream>

class Test
{
public:
    Test()
    {
        std::cout<<"构造函数"<<std::endl;
        a = new int;
    }
    Test(const Test& t)
    {
        std::cout<<"拷贝构造"<<std::endl;
        a = new int;
        *a = *t.a;
    }

    void operator=(const Test& t)
    {
        delete a;
        std::cout<<"运算符的重载"<<std::endl;
        a = new int;
        *a = *t.a;
    }
    ~Test()
    {
        std::cout<<"析构函数"<<std::endl;
        delete a;
    }

private:
    int *a;
};

int main()
{
    Test t;
    Test t2(t);
    t2 = t;
    return 0;
}
